import axios from 'axios'

const SUCCESS_CODE = 200 // 成功

const request = axios.create({
  baseURL: 'https://socket.worldzb.cn',
})

request.interceptors.response.use(
  // 请求成功
  (response) => {
    let data = response.data
    if (!(data instanceof Object)) {
      try {
        data = JSON.parse(data)
      } catch (error) {
        //
      }
    }
    return data.Data
  },
  // 请求失败
  (error) => Promise.reject(error.response)
)

export default request
